package com.wit.witmg.api;


import com.wit.witmg.service.ITDeliverService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * @author bob
 * @since 2025-02-18
 */
@RestController
@RequestMapping("deliver")
@Api(tags = "发货清单API")
public class DeliverController {
    @Resource
    private ITDeliverService service;

    @ApiOperation("添加")
    @PostMapping("add")
    public Object add(HttpServletRequest request,
                      @RequestParam("json") String json,
                      @RequestParam(value = "prod",required = false) String prod) {
        return service.add(request,json,prod);
    }

    @ApiOperation("获取")
    @PostMapping("get")
    public Object get(HttpServletRequest request,//参数：cid客户id返回cid对应的数据、oid返回oid以参数开头并包含参数的数据；id返回单条数据，常用于连表查询。
                      @RequestParam(value = "id",required = false) Integer id,
                      @RequestParam(value = "cbn",required = false) String cbn,
                      @RequestParam(value = "oid",required = false) String oid,
                      @RequestParam(value = "stat",required = false) String stat
    ) {
        return service.get(request,id,cbn,oid,stat);
    }
}
